package com.ymatou.iapi.prodstock.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.LiveActivityDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取直播活动商品列表Call
*FreeMaker Template自动生成代码
*/
public class GetActivityProductListCall extends YmatouBaseCall{
	private static String opurl ="api/Product/GetActivityProductList";
	
	public GetActivityProductListCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<LiveActivityDto> getLiveActivityList(){
		String sLiveActivityDto=getJsonObject().get("Data").getAsJsonObject().get("LiveActivityList").getAsJsonArray().toString();
		List<LiveActivityDto> LiveActivityList=(List<LiveActivityDto>)FormatUtil.GSONToObject(sLiveActivityDto, new TypeToken<List<LiveActivityDto>>(){}.getType());
		return LiveActivityList;
	}
}